package controller

import (
	"gf-start-kit/library/base"
	"gf-start-kit/library/mq"
	"gf-start-kit/library/resp"
	"gf-start-kit/library/router"
	"github.com/gogf/gf/net/ghttp"
)

type MqController struct {
	base.Controller
}

func init() {
	ctl := new(MqController)
	router.New("xx", "nsg").GET("/pub", ctl.PUB)
}

func (a *MqController) PUB(r *ghttp.Request) {
	mq.NewProducer().SetTopic(r.GetString("tip")).Pub(r.GetString("msg"))
	resp.Success(r).SetMsg("tip" + r.GetString("tip") + "pub:" + r.GetString("msg")).Json()
}
